home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 2.iso / dist / fw_libpng.idb / usr / freeware / include / pngconf.h.z / pngconf.h
C/C++ Source or Header  |  2002-10-07  |  41KB  |  1,351 lines

  1. /* pngconf.h - machine configurable file for libpng
  2.  *
  3.  * libpng 1.0.14 - July 8, 2002
  4.  * For conditions of distribution and use, see copyright notice in png.h
  5.  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  6.  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  7.  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  8.  */
  9.  
  10. /* Any machine specific code is near the front of this file, so if you
  11.  * are configuring libpng for a machine, you may want to read the section
  12.  * starting here down to where it starts to typedef png_color, png_text,
  13.  * and png_info.
  14.  */
  15.  
  16. #ifndef PNGCONF_H
  17. #define PNGCONF_H
  18.  
  19. #define PNG_1_0_X
  20.  
  21. /* This is the size of the compression buffer, and thus the size of
  22.  * an IDAT chunk.  Make this whatever size you feel is best for your
  23.  * machine.  One of these will be allocated per png_struct.  When this
  24.  * is full, it writes the data to the disk, and does some other
  25.  * calculations.  Making this an extremely small size will slow
  26.  * the library down, but you may want to experiment to determine
  27.  * where it becomes significant, if you are concerned with memory
  28.  * usage.  Note that zlib allocates at least 32Kb also.  For readers,
  29.  * this describes the size of the buffer available to read the data in.
  30.  * Unless this gets smaller than the size of a row (compressed),
  31.  * it should not make much difference how big this is.
  32.  */
  33.  
  34. #ifndef PNG_ZBUF_SIZE
  35. #  define PNG_ZBUF_SIZE 8192
  36. #endif
  37.  
  38. /* Enable if you want a write-only libpng */
  39.  
  40. #ifndef PNG_NO_READ_SUPPORTED
  41. #  define PNG_READ_SUPPORTED
  42. #endif
  43.  
  44. /* Enable if you want a read-only libpng */
  45.  
  46. #ifndef PNG_NO_WRITE_SUPPORTED
  47. #  define PNG_WRITE_SUPPORTED
  48. #endif
  49.  
  50. /* Enabled by default in 1.2.0.  You can disable this if you don't need to
  51.    support PNGs that are embedded in MNG datastreams */
  52. #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
  53. #  ifndef PNG_MNG_FEATURES_SUPPORTED
  54. #    define PNG_MNG_FEATURES_SUPPORTED
  55. #  endif
  56. #endif
  57.  
  58. #ifndef PNG_NO_FLOATING_POINT_SUPPORTED
  59. #  ifndef PNG_FLOATING_POINT_SUPPORTED
  60. #    define PNG_FLOATING_POINT_SUPPORTED
  61. #  endif
  62. #endif
  63.  
  64. /* If you are running on a machine where you cannot allocate more
  65.  * than 64K of memory at once, uncomment this.  While libpng will not
  66.  * normally need that much memory in a chunk (unless you load up a very
  67.  * large file), zlib needs to know how big of a chunk it can use, and
  68.  * libpng thus makes sure to check any memory allocation to verify it
  69.  * will fit into memory.
  70. #define PNG_MAX_MALLOC_64K
  71.  */
  72. #if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
  73. #  define PNG_MAX_MALLOC_64K
  74. #endif
  75.  
  76. /* Special munging to support doing things the 'cygwin' way:
  77.  * 'Normal' png-on-win32 defines/defaults:
  78.  *   PNG_BUILD_DLL -- building dll
  79.  *   PNG_USE_DLL   -- building an application, linking to dll
  80.  *   (no define)   -- building static library, or building an
  81.  *                    application and linking to the static lib
  82.  * 'Cygwin' defines/defaults:
  83.  *   PNG_BUILD_DLL -- (ignored) building the dll
  84.  *   (no define)   -- (ignored) building an application, linking to the dll
  85.  *   PNG_STATIC    -- (ignored) building the static lib, or building an 
  86.  *                    application that links to the static lib.
  87.  *   ALL_STATIC    -- (ignored) building various static libs, or building an 
  88.  *                    application that links to the static libs.
  89.  * Thus,
  90.  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
  91.  * this bit of #ifdefs will define the 'correct' config variables based on
  92.  * that. If a cygwin user *wants* to define 'PNG_USE_DLL' that's okay, but
  93.  * unnecessary.
  94.  *
  95.  * Also, the precedence order is:
  96.  *   ALL_STATIC (since we can't #undef something outside our namespace)
  97.  *   PNG_BUILD_DLL
  98.  *   PNG_STATIC
  99.  *   (nothing) == PNG_USE_DLL
  100.  * 
  101.  * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
  102.  *   of auto-import in binutils, we no longer need to worry about 
  103.  *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
  104.  *   we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
  105.  *   to __declspec() stuff.  However, we DO need to worry about 
  106.  *   PNG_BUILD_DLL and PNG_STATIC because those change some defaults
  107.  *   such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
  108.  */
  109. #if defined(__CYGWIN__)
  110. #  if defined(ALL_STATIC)
  111. #    if defined(PNG_BUILD_DLL)
  112. #      undef PNG_BUILD_DLL
  113. #    endif
  114. #    if defined(PNG_USE_DLL)
  115. #      undef PNG_USE_DLL
  116. #    endif
  117. #    if defined(PNG_DLL)
  118. #      undef PNG_DLL
  119. #    endif
  120. #    if !defined(PNG_STATIC)
  121. #      define PNG_STATIC
  122. #    endif
  123. #  else
  124. #    if defined (PNG_BUILD_DLL)
  125. #      if defined(PNG_STATIC)
  126. #        undef PNG_STATIC
  127. #      endif
  128. #      if defined(PNG_USE_DLL)
  129. #        undef PNG_USE_DLL
  130. #      endif
  131. #      if !defined(PNG_DLL)
  132. #        define PNG_DLL
  133. #      endif
  134. #    else
  135. #      if defined(PNG_STATIC)
  136. #        if defined(PNG_USE_DLL)
  137. #          undef PNG_USE_DLL
  138. #        endif
  139. #        if defined(PNG_DLL)
  140. #          undef PNG_DLL
  141. #        endif
  142. #      else
  143. #        if !defined(PNG_USE_DLL)
  144. #          define PNG_USE_DLL
  145. #        endif
  146. #        if !defined(PNG_DLL)
  147. #          define PNG_DLL
  148. #        endif
  149. #      endif  
  150. #    endif  
  151. #  endif
  152. #endif
  153.  
  154. /* This protects us against compilers that run on a windowing system
  155.  * and thus don't have or would rather us not use the stdio types:
  156.  * stdin, stdout, and stderr.  The only one currently used is stderr
  157.  * in png_error() and png_warning().  #defining PNG_NO_CONSOLE_IO will
  158.  * prevent these from being compiled and used. #defining PNG_NO_STDIO
  159.  * will also prevent these, plus will prevent the entire set of stdio
  160.  * macros and functions (FILE *, printf, etc.) from being compiled and used,
  161.  * unless (PNG_DEBUG > 0) has been #defined.
  162.  *
  163.  * #define PNG_NO_CONSOLE_IO
  164.  * #define PNG_NO_STDIO
  165.  */
  166.  
  167. #if defined(_WIN32_WCE)
  168. #  include <windows.h>
  169.    /* Console I/O functions are not supported on WindowsCE */
  170. #  define PNG_NO_CONSOLE_IO
  171. #  ifdef PNG_DEBUG
  172. #    undef PNG_DEBUG
  173. #  endif
  174. #endif
  175.  
  176. #ifdef PNG_BUILD_DLL
  177. #  ifndef PNG_CONSOLE_IO_SUPPORTED
  178. #    ifndef PNG_NO_CONSOLE_IO
  179. #      define PNG_NO_CONSOLE_IO
  180. #    endif
  181. #  endif
  182. #endif
  183.  
  184. #  ifdef PNG_NO_STDIO
  185. #    ifndef PNG_NO_CONSOLE_IO
  186. #      define PNG_NO_CONSOLE_IO
  187. #    endif
  188. #    ifdef PNG_DEBUG
  189. #      if (PNG_DEBUG > 0)
  190. #        include <stdio.h>
  191. #      endif
  192. #    endif
  193. #  else
  194. #    if !defined(_WIN32_WCE)
  195. /* "stdio.h" functions are not supported on WindowsCE */
  196. #      include <stdio.h>
  197. #    endif
  198. #  endif
  199.  
  200. /* This macro protects us against machines that don't have function
  201.  * prototypes (ie K&R style headers).  If your compiler does not handle
  202.  * function prototypes, define this macro and use the included ansi2knr.
  203.  * I've always been able to use _NO_PROTO as the indicator, but you may
  204.  * need to drag the empty declaration out in front of here, or change the
  205.  * ifdef to suit your own needs.
  206.  */
  207. #ifndef PNGARG
  208.  
  209. #ifdef OF /* zlib prototype munger */
  210. #  define PNGARG(arglist) OF(arglist)
  211. #else
  212.  
  213. #ifdef _NO_PROTO
  214. #  define PNGARG(arglist) ()
  215. #  ifndef PNG_TYPECAST_NULL
  216. #     define PNG_TYPECAST_NULL
  217. #  endif
  218. #else
  219. #  define PNGARG(arglist) arglist
  220. #endif /* _NO_PROTO */
  221.  
  222. #endif /* OF */
  223.  
  224. #endif /* PNGARG */
  225.  
  226. /* Try to determine if we are compiling on a Mac.  Note that testing for
  227.  * just __MWERKS__ is not good enough, because the Codewarrior is now used
  228.  * on non-Mac platforms.
  229.  */
  230. #ifndef MACOS
  231. #  if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
  232.       defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
  233. #    define MACOS
  234. #  endif
  235. #endif
  236.  
  237. /* enough people need this for various reasons to include it here */
  238. #if !defined(MACOS) && !defined(RISCOS) && !defined(_WIN32_WCE)
  239. #  include <sys/types.h>
  240. #endif
  241.  
  242. #if !defined(PNG_SETJMP_NOT_SUPPORTED) && !defined(PNG_NO_SETJMP_SUPPORTED)
  243. #  define PNG_SETJMP_SUPPORTED
  244. #endif
  245.  
  246. #ifdef PNG_SETJMP_SUPPORTED
  247. /* This is an attempt to force a single setjmp behaviour on Linux.  If
  248.  * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
  249.  */
  250.  
  251. #  ifdef __linux__
  252. #    ifdef _BSD_SOURCE
  253. #      define PNG_SAVE_BSD_SOURCE
  254. #      undef _BSD_SOURCE
  255. #    endif
  256. #    ifdef _SETJMP_H
  257.       __png.h__ already includes setjmp.h;
  258.       __dont__ include it again.;
  259. #    endif
  260. #  endif /* __linux__ */
  261.  
  262.    /* include setjmp.h for error handling */
  263. #  include <setjmp.h>
  264.  
  265. #  ifdef __linux__
  266. #    ifdef PNG_SAVE_BSD_SOURCE
  267. #      define _BSD_SOURCE
  268. #      undef PNG_SAVE_BSD_SOURCE
  269. #    endif
  270. #  endif /* __linux__ */
  271. #endif /* PNG_SETJMP_SUPPORTED */
  272.  
  273. #ifdef BSD
  274. #  include <strings.h>
  275. #else
  276. #  include <string.h>
  277. #endif
  278.  
  279. /* Other defines for things like memory and the like can go here.  */
  280. #ifdef PNG_INTERNAL
  281.  
  282. #include <stdlib.h>
  283.  
  284. /* The functions exported by PNG_EXTERN are PNG_INTERNAL functions, which
  285.  * aren't usually used outside the library (as far as I know), so it is
  286.  * debatable if they should be exported at all.  In the future, when it is
  287.  * possible to have run-time registry of chunk-handling functions, some of
  288.  * these will be made available again.
  289. #define PNG_EXTERN extern
  290.  */
  291. #define PNG_EXTERN
  292.  
  293. /* Other defines specific to compilers can go here.  Try to keep
  294.  * them inside an appropriate ifdef/endif pair for portability.
  295.  */
  296.  
  297. #if defined(PNG_FLOATING_POINT_SUPPORTED)
  298. #  if defined(MACOS)
  299.      /* We need to check that <math.h> hasn't already been included earlier
  300.       * as it seems it doesn't agree with <fp.h>, yet we should really use
  301.       * <fp.h> if possible.
  302.       */
  303. #    if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
  304. #      include <fp.h>
  305. #    endif
  306. #  else
  307. #    include <math.h>
  308. #  endif
  309. #  if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
  310.      /* Amiga SAS/C: We must include builtin FPU functions when compiling using
  311.       * MATH=68881
  312.       */
  313. #    include <m68881.h>
  314. #  endif
  315. #endif
  316.  
  317. /* Codewarrior on NT has linking problems without this. */
  318. #if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
  319. #  define PNG_ALWAYS_EXTERN
  320. #endif
  321.  
  322. /* For some reason, Borland C++ defines memcmp, etc. in mem.h, not
  323.  * stdlib.h like it should (I think).  Or perhaps this is a C++
  324.  * "feature"?
  325.  */
  326. #ifdef __TURBOC__
  327. #  include <mem.h>
  328. #  include "alloc.h"
  329. #endif
  330.  
  331. #if defined(_MSC_VER) && (defined(WIN32) || defined(_Windows) || \
  332.     defined(_WINDOWS) || defined(_WIN32) || defined(__WIN32__))
  333. #  include <malloc.h>
  334. #endif
  335.  
  336. /* This controls how fine the dithering gets.  As this allocates
  337.  * a largish chunk of memory (32K), those who are not as concerned
  338.  * with dithering quality can decrease some or all of these.
  339.  */
  340. #ifndef PNG_DITHER_RED_BITS
  341. #  define PNG_DITHER_RED_BITS 5
  342. #endif
  343. #ifndef PNG_DITHER_GREEN_BITS
  344. #  define PNG_DITHER_GREEN_BITS 5
  345. #endif
  346. #ifndef PNG_DITHER_BLUE_BITS
  347. #  define PNG_DITHER_BLUE_BITS 5
  348. #endif
  349.  
  350. /* This controls how fine the gamma correction becomes when you
  351.  * are only interested in 8 bits anyway.  Increasing this value
  352.  * results in more memory being used, and more pow() functions
  353.  * being called to fill in the gamma tables.  Don't set this value
  354.  * less then 8, and even that may not work (I haven't tested it).
  355.  */
  356.  
  357. #ifndef PNG_MAX_GAMMA_8
  358. #  define PNG_MAX_GAMMA_8 11
  359. #endif
  360.  
  361. /* This controls how much a difference in gamma we can tolerate before
  362.  * we actually start doing gamma conversion.
  363.  */
  364. #ifndef PNG_GAMMA_THRESHOLD
  365. #  define PNG_GAMMA_THRESHOLD 0.05
  366. #endif
  367.  
  368. #endif /* PNG_INTERNAL */
  369.  
  370. /* The following uses const char * instead of char * for error
  371.  * and warning message functions, so some compilers won't complain.
  372.  * If you do not want to use const, define PNG_NO_CONST here.
  373.  */
  374.  
  375. #ifndef PNG_NO_CONST
  376. #  define PNG_CONST const
  377. #else
  378. #  define PNG_CONST
  379. #endif
  380.  
  381. /* The following defines give you the ability to remove code from the
  382.  * library that you will not be using.  I wish I could figure out how to
  383.  * automate this, but I can't do that without making it seriously hard
  384.  * on the users.  So if you are not using an ability, change the #define
  385.  * to and #undef, and that part of the library will not be compiled.  If
  386.  * your linker can't find a function, you may want to make sure the
  387.  * ability is defined here.  Some of these depend upon some others being
  388.  * defined.  I haven't figured out all the interactions here, so you may
  389.  * have to experiment awhile to get everything to compile.  If you are
  390.  * creating or using a shared library, you probably shouldn't touch this,
  391.  * as it will affect the size of the structures, and this will cause bad
  392.  * things to happen if the library and/or application ever change.
  393.  */
  394.  
  395. /* Any features you will not be using can be undef'ed here */
  396.  
  397. /* GR-P, 0.96a: Set "*TRANSFORMS_SUPPORTED as default but allow user
  398.  * to turn it off with "*TRANSFORMS_NOT_SUPPORTED" or *PNG_NO_*_TRANSFORMS
  399.  * on the compile line, then pick and choose which ones to define without
  400.  * having to edit this file. It is safe to use the *TRANSFORMS_NOT_SUPPORTED
  401.  * if you only want to have a png-compliant reader/writer but don't need
  402.  * any of the extra transformations.  This saves about 80 kbytes in a
  403.  * typical installation of the library. (PNG_NO_* form added in version
  404.  * 1.0.1c, for consistency)
  405.  */
  406.  
  407. /* The size of the png_text structure changed in libpng-1.0.6 when
  408.  * iTXt is supported.  It is turned off by default, to support old apps
  409.  * that malloc the png_text structure instead of calling png_set_text()
  410.  * and letting libpng malloc it.  It will be turned on by default in
  411.  * libpng-1.3.0.
  412.  */
  413.  
  414. #ifndef PNG_iTXt_SUPPORTED
  415. #  if !defined(PNG_READ_iTXt_SUPPORTED) && !defined(PNG_NO_READ_iTXt)
  416. #    define PNG_NO_READ_iTXt
  417. #  endif
  418. #  if !defined(PNG_WRITE_iTXt_SUPPORTED) && !defined(PNG_NO_WRITE_iTXt)
  419. #    define PNG_NO_WRITE_iTXt
  420. #  endif
  421. #endif
  422.  
  423. /* The following support, added after version 1.0.0, can be turned off here en
  424.  * masse by defining PNG_LEGACY_SUPPORTED in case you need binary compatibility
  425.  * with old applications that require the length of png_struct and png_info
  426.  * to remain unchanged.
  427.  */
  428.  
  429. #ifdef PNG_LEGACY_SUPPORTED
  430. #  define PNG_NO_FREE_ME
  431. #  define PNG_NO_READ_UNKNOWN_CHUNKS
  432. #  define PNG_NO_WRITE_UNKNOWN_CHUNKS
  433. #  define PNG_NO_READ_USER_CHUNKS
  434. #  define PNG_NO_READ_iCCP
  435. #  define PNG_NO_WRITE_iCCP
  436. #  define PNG_NO_READ_iTXt
  437. #  define PNG_NO_WRITE_iTXt
  438. #  define PNG_NO_READ_sCAL
  439. #  define PNG_NO_WRITE_sCAL
  440. #  define PNG_NO_READ_sPLT
  441. #  define PNG_NO_WRITE_sPLT
  442. #  define PNG_NO_INFO_IMAGE
  443. #  define PNG_NO_READ_RGB_TO_GRAY
  444. #  define PNG_NO_READ_USER_TRANSFORM
  445. #  define PNG_NO_WRITE_USER_TRANSFORM
  446. #  define PNG_NO_USER_MEM
  447. #  define PNG_NO_READ_EMPTY_PLTE
  448. #  define PNG_NO_MNG_FEATURES
  449. #  define PNG_NO_FIXED_POINT_SUPPORTED
  450. #endif
  451.  
  452. /* Ignore attempt to turn off both floating and fixed point support */
  453. #if !defined(PNG_FLOATING_POINT_SUPPORTED) || \
  454.     !defined(PNG_NO_FIXED_POINT_SUPPORTED)
  455. #  define PNG_FIXED_POINT_SUPPORTED
  456. #endif
  457.  
  458. #ifndef PNG_NO_FREE_ME
  459. #  define PNG_FREE_ME_SUPPORTED
  460. #endif
  461.  
  462. #if defined(PNG_READ_SUPPORTED)
  463.  
  464. #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
  465.       !defined(PNG_NO_READ_TRANSFORMS)
  466. #  define PNG_READ_TRANSFORMS_SUPPORTED
  467. #endif
  468.  
  469. #ifdef PNG_READ_TRANSFORMS_SUPPORTED
  470. #  ifndef PNG_NO_READ_EXPAND
  471. #    define PNG_READ_EXPAND_SUPPORTED
  472. #  endif
  473. #  ifndef PNG_NO_READ_SHIFT
  474. #    define PNG_READ_SHIFT_SUPPORTED
  475. #  endif
  476. #  ifndef PNG_NO_READ_PACK
  477. #    define PNG_READ_PACK_SUPPORTED
  478. #  endif
  479. #  ifndef PNG_NO_READ_BGR
  480. #    define PNG_READ_BGR_SUPPORTED
  481. #  endif
  482. #  ifndef PNG_NO_READ_SWAP
  483. #    define PNG_READ_SWAP_SUPPORTED
  484. #  endif
  485. #  ifndef PNG_NO_READ_PACKSWAP
  486. #    define PNG_READ_PACKSWAP_SUPPORTED
  487. #  endif
  488. #  ifndef PNG_NO_READ_INVERT
  489. #    define PNG_READ_INVERT_SUPPORTED
  490. #  endif
  491. #  ifndef PNG_NO_READ_DITHER
  492. #    define PNG_READ_DITHER_SUPPORTED
  493. #  endif
  494. #  ifndef PNG_NO_READ_BACKGROUND
  495. #    define PNG_READ_BACKGROUND_SUPPORTED
  496. #  endif
  497. #  ifndef PNG_NO_READ_16_TO_8
  498. #    define PNG_READ_16_TO_8_SUPPORTED
  499. #  endif
  500. #  ifndef PNG_NO_READ_FILLER
  501. #    define PNG_READ_FILLER_SUPPORTED
  502. #  endif
  503. #  ifndef PNG_NO_READ_GAMMA
  504. #    define PNG_READ_GAMMA_SUPPORTED
  505. #  endif
  506. #  ifndef PNG_NO_READ_GRAY_TO_RGB
  507. #    define PNG_READ_GRAY_TO_RGB_SUPPORTED
  508. #  endif
  509. #  ifndef PNG_NO_READ_SWAP_ALPHA
  510. #    define PNG_READ_SWAP_ALPHA_SUPPORTED
  511. #  endif
  512. #  ifndef PNG_NO_READ_INVERT_ALPHA
  513. #    define PNG_READ_INVERT_ALPHA_SUPPORTED
  514. #  endif
  515. #  ifndef PNG_NO_READ_STRIP_ALPHA
  516. #    define PNG_READ_STRIP_ALPHA_SUPPORTED
  517. #  endif
  518. #  ifndef PNG_NO_READ_USER_TRANSFORM
  519. #    define PNG_READ_USER_TRANSFORM_SUPPORTED
  520. #  endif
  521. #  ifndef PNG_NO_READ_RGB_TO_GRAY
  522. #    define PNG_READ_RGB_TO_GRAY_SUPPORTED
  523. #  endif
  524. #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
  525.  
  526. #if !defined(PNG_NO_PROGRESSIVE_READ) && \
  527.  !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED)  /* if you don't do progressive */
  528. #  define PNG_PROGRESSIVE_READ_SUPPORTED     /* reading.  This is not talking */
  529. #endif                               /* about interlacing capability!  You'll */
  530.               /* still have interlacing unless you change the following line: */
  531.  
  532. #define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
  533.  
  534. #ifndef PNG_NO_READ_COMPOSITE_NODIV
  535. #  ifndef PNG_NO_READ_COMPOSITED_NODIV  /* libpng-1.0.x misspelling */
  536. #    define PNG_READ_COMPOSITE_NODIV_SUPPORTED   /* well tested on Intel, SGI */
  537. #  endif
  538. #endif
  539.  
  540. /* Deprecated, will be removed from version 2.0.0.
  541.    Use PNG_MNG_FEATURES_SUPPORTED instead. */
  542. #ifndef PNG_NO_READ_EMPTY_PLTE
  543. #  define PNG_READ_EMPTY_PLTE_SUPPORTED
  544. #endif
  545.  
  546. #endif /* PNG_READ_SUPPORTED */
  547.  
  548. #if defined(PNG_WRITE_SUPPORTED)
  549.  
  550. # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
  551.     !defined(PNG_NO_WRITE_TRANSFORMS)
  552. #  define PNG_WRITE_TRANSFORMS_SUPPORTED
  553. #endif
  554.  
  555. #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
  556. #  ifndef PNG_NO_WRITE_SHIFT
  557. #    define PNG_WRITE_SHIFT_SUPPORTED
  558. #  endif
  559. #  ifndef PNG_NO_WRITE_PACK
  560. #    define PNG_WRITE_PACK_SUPPORTED
  561. #  endif
  562. #  ifndef PNG_NO_WRITE_BGR
  563. #    define PNG_WRITE_BGR_SUPPORTED
  564. #  endif
  565. #  ifndef PNG_NO_WRITE_SWAP
  566. #    define PNG_WRITE_SWAP_SUPPORTED
  567. #  endif
  568. #  ifndef PNG_NO_WRITE_PACKSWAP
  569. #    define PNG_WRITE_PACKSWAP_SUPPORTED
  570. #  endif
  571. #  ifndef PNG_NO_WRITE_INVERT
  572. #    define PNG_WRITE_INVERT_SUPPORTED
  573. #  endif
  574. #  ifndef PNG_NO_WRITE_FILLER
  575. #    define PNG_WRITE_FILLER_SUPPORTED   /* same as WRITE_STRIP_ALPHA */
  576. #  endif
  577. #  ifndef PNG_NO_WRITE_SWAP_ALPHA
  578. #    define PNG_WRITE_SWAP_ALPHA_SUPPORTED
  579. #  endif
  580. #  ifndef PNG_NO_WRITE_INVERT_ALPHA
  581. #    define PNG_WRITE_INVERT_ALPHA_SUPPORTED
  582. #  endif
  583. #  ifndef PNG_NO_WRITE_USER_TRANSFORM
  584. #    define PNG_WRITE_USER_TRANSFORM_SUPPORTED
  585. #  endif
  586. #endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
  587.  
  588. #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
  589.     defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
  590. #  ifndef PNG_NO_USER_TRANSFORM_PTR
  591. #    define PNG_USER_TRANSFORM_PTR_SUPPORTED
  592. #  endif
  593. #endif
  594.  
  595. #define PNG_WRITE_INTERLACING_SUPPORTED  /* not required for PNG-compliant
  596.                                             encoders, but can cause trouble
  597.                                             if left undefined */
  598.  
  599. #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \
  600.      defined(PNG_FLOATING_POINT_SUPPORTED)
  601. #  define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
  602. #endif
  603.  
  604. #ifndef PNG_1_0_X
  605. #ifndef PNG_NO_ERROR_NUMBERS
  606. #define PNG_ERROR_NUMBERS_SUPPORTED
  607. #endif
  608. #endif /* PNG_1_0_X */
  609.  
  610. #ifndef PNG_NO_WRITE_FLUSH
  611. #  define PNG_WRITE_FLUSH_SUPPORTED
  612. #endif
  613.  
  614. /* Deprecated, see PNG_MNG_FEATURES_SUPPORTED, above */
  615. #ifndef PNG_NO_WRITE_EMPTY_PLTE
  616. #  define PNG_WRITE_EMPTY_PLTE_SUPPORTED
  617. #endif
  618.  
  619. #endif /* PNG_WRITE_SUPPORTED */
  620.  
  621. #ifndef PNG_NO_STDIO
  622. #  define PNG_TIME_RFC1123_SUPPORTED
  623. #endif
  624.  
  625. /* This adds extra functions in pngget.c for accessing data from the
  626.  * info pointer (added in version 0.99)
  627.  * png_get_image_width()
  628.  * png_get_image_height()
  629.  * png_get_bit_depth()
  630.  * png_get_color_type()
  631.  * png_get_compression_type()
  632.  * png_get_filter_type()
  633.  * png_get_interlace_type()
  634.  * png_get_pixel_aspect_ratio()
  635.  * png_get_pixels_per_meter()
  636.  * png_get_x_offset_pixels()
  637.  * png_get_y_offset_pixels()
  638.  * png_get_x_offset_microns()
  639.  * png_get_y_offset_microns()
  640.  */
  641. #if !defined(PNG_NO_EASY_ACCESS) && !defined(PNG_EASY_ACCESS_SUPPORTED)
  642. #  define PNG_EASY_ACCESS_SUPPORTED
  643. #endif
  644.  
  645. /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 
  646.    even when PNG_USE_PNGVCRD or PNG_USE_PNGGCCRD is not defined */
  647. #if defined(PNG_READ_SUPPORTED) && !defined(PNG_NO_ASSEMBLER_CODE)
  648. #  ifndef PNG_ASSEMBLER_CODE_SUPPORTED
  649. #    define PNG_ASSEMBLER_CODE_SUPPORTED
  650. #  endif
  651. #  if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
  652. #    define PNG_MMX_CODE_SUPPORTED
  653. #  endif
  654. #endif
  655.  
  656. /* If you are sure that you don't need thread safety and you are compiling
  657.    with PNG_USE_PNGCCRD for an MMX application, you can define this for
  658.    faster execution.  See pnggccrd.c.
  659. #define PNG_THREAD_UNSAFE_OK
  660. */
  661.  
  662. #if !defined(PNG_1_0_X)
  663. #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
  664. #  define PNG_USER_MEM_SUPPORTED
  665. #endif
  666. #endif /* PNG_1_0_X */
  667.  
  668. /* These are currently experimental features, define them if you want */
  669.  
  670. /* very little testing */
  671. /*
  672. #ifdef PNG_READ_SUPPORTED
  673. #  ifndef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
  674. #    define PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
  675. #  endif
  676. #endif
  677. */
  678.  
  679. /* This is only for PowerPC big-endian and 680x0 systems */
  680. /* some testing */
  681. /*
  682. #ifdef PNG_READ_SUPPORTED
  683. #  ifndef PNG_PNG_READ_BIG_ENDIAN_SUPPORTED
  684. #    define PNG_READ_BIG_ENDIAN_SUPPORTED
  685. #  endif
  686. #endif
  687. */
  688.  
  689. /* Buggy compilers (e.g., gcc 2.7.2.2) need this */
  690. /*
  691. #define PNG_NO_POINTER_INDEXING
  692. */
  693.  
  694. /* These functions are turned off by default, as they will be phased out. */
  695. /*
  696. #define  PNG_USELESS_TESTS_SUPPORTED
  697. #define  PNG_CORRECT_PALETTE_SUPPORTED
  698. */
  699.  
  700. /* Any chunks you are not interested in, you can undef here.  The
  701.  * ones that allocate memory may be expecially important (hIST,
  702.  * tEXt, zTXt, tRNS, pCAL).  Others will just save time and make png_info
  703.  * a bit smaller.
  704.  */
  705.  
  706. #if defined(PNG_READ_SUPPORTED) && \
  707.     !defined(PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  708.     !defined(PNG_NO_READ_ANCILLARY_CHUNKS)
  709. #  define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  710. #endif
  711.  
  712. #if defined(PNG_WRITE_SUPPORTED) && \
  713.     !defined(PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED) && \
  714.     !defined(PNG_NO_WRITE_ANCILLARY_CHUNKS)
  715. #  define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  716. #endif
  717.  
  718. #ifdef PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
  719.  
  720. #ifdef PNG_NO_READ_TEXT
  721. #  define PNG_NO_READ_iTXt
  722. #  define PNG_NO_READ_tEXt
  723. #  define PNG_NO_READ_zTXt
  724. #endif
  725. #ifndef PNG_NO_READ_bKGD
  726. #  define PNG_READ_bKGD_SUPPORTED
  727. #  define PNG_bKGD_SUPPORTED
  728. #endif
  729. #ifndef PNG_NO_READ_cHRM
  730. #  define PNG_READ_cHRM_SUPPORTED
  731. #  define PNG_cHRM_SUPPORTED
  732. #endif
  733. #ifndef PNG_NO_READ_gAMA
  734. #  define PNG_READ_gAMA_SUPPORTED
  735. #  define PNG_gAMA_SUPPORTED
  736. #endif
  737. #ifndef PNG_NO_READ_hIST
  738. #  define PNG_READ_hIST_SUPPORTED
  739. #  define PNG_hIST_SUPPORTED
  740. #endif
  741. #ifndef PNG_NO_READ_iCCP
  742. #  define PNG_READ_iCCP_SUPPORTED
  743. #  define PNG_iCCP_SUPPORTED
  744. #endif
  745. #ifndef PNG_NO_READ_iTXt
  746. #  ifndef PNG_READ_iTXt_SUPPORTED
  747. #    define PNG_READ_iTXt_SUPPORTED
  748. #  endif
  749. #  ifndef PNG_iTXt_SUPPORTED
  750. #    define PNG_iTXt_SUPPORTED
  751. #  endif
  752. #endif
  753. #ifndef PNG_NO_READ_oFFs
  754. #  define PNG_READ_oFFs_SUPPORTED
  755. #  define PNG_oFFs_SUPPORTED
  756. #endif
  757. #ifndef PNG_NO_READ_pCAL
  758. #  define PNG_READ_pCAL_SUPPORTED
  759. #  define PNG_pCAL_SUPPORTED
  760. #endif
  761. #ifndef PNG_NO_READ_sCAL
  762. #  define PNG_READ_sCAL_SUPPORTED
  763. #  define PNG_sCAL_SUPPORTED
  764. #endif
  765. #ifndef PNG_NO_READ_pHYs
  766. #  define PNG_READ_pHYs_SUPPORTED
  767. #  define PNG_pHYs_SUPPORTED
  768. #endif
  769. #ifndef PNG_NO_READ_sBIT
  770. #  define PNG_READ_sBIT_SUPPORTED
  771. #  define PNG_sBIT_SUPPORTED
  772. #endif
  773. #ifndef PNG_NO_READ_sPLT
  774. #  define PNG_READ_sPLT_SUPPORTED
  775. #  define PNG_sPLT_SUPPORTED
  776. #endif
  777. #ifndef PNG_NO_READ_sRGB
  778. #  define PNG_READ_sRGB_SUPPORTED
  779. #  define PNG_sRGB_SUPPORTED
  780. #endif
  781. #ifndef PNG_NO_READ_tEXt
  782. #  define PNG_READ_tEXt_SUPPORTED
  783. #  define PNG_tEXt_SUPPORTED
  784. #endif
  785. #ifndef PNG_NO_READ_tIME
  786. #  define PNG_READ_tIME_SUPPORTED
  787. #  define PNG_tIME_SUPPORTED
  788. #endif
  789. #ifndef PNG_NO_READ_tRNS
  790. #  define PNG_READ_tRNS_SUPPORTED
  791. #  define PNG_tRNS_SUPPORTED
  792. #endif
  793. #ifndef PNG_NO_READ_zTXt
  794. #  define PNG_READ_zTXt_SUPPORTED
  795. #  define PNG_zTXt_SUPPORTED
  796. #endif
  797. #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
  798. #  define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
  799. #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  800. #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  801. #  endif
  802. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  803. #    define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  804. #  endif
  805. #endif
  806. #if !defined(PNG_NO_READ_USER_CHUNKS) && \
  807.      defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
  808. #  define PNG_READ_USER_CHUNKS_SUPPORTED
  809. #  define PNG_USER_CHUNKS_SUPPORTED
  810. #  ifdef PNG_NO_READ_UNKNOWN_CHUNKS
  811. #    undef PNG_NO_READ_UNKNOWN_CHUNKS
  812. #  endif
  813. #  ifdef PNG_NO_HANDLE_AS_UNKNOWN
  814. #    undef PNG_NO_HANDLE_AS_UNKNOWN
  815. #  endif
  816. #endif
  817. #ifndef PNG_NO_READ_OPT_PLTE
  818. #  define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
  819. #endif                      /* optional PLTE chunk in RGB and RGBA images */
  820. #if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
  821.     defined(PNG_READ_zTXt_SUPPORTED)
  822. #  define PNG_READ_TEXT_SUPPORTED
  823. #  define PNG_TEXT_SUPPORTED
  824. #endif
  825.  
  826. #endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
  827.  
  828. #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
  829.  
  830. #ifdef PNG_NO_WRITE_TEXT
  831. #  define PNG_NO_WRITE_iTXt
  832. #  define PNG_NO_WRITE_tEXt
  833. #  define PNG_NO_WRITE_zTXt
  834. #endif
  835. #ifndef PNG_NO_WRITE_bKGD
  836. #  define PNG_WRITE_bKGD_SUPPORTED
  837. #  ifndef PNG_bKGD_SUPPORTED
  838. #    define PNG_bKGD_SUPPORTED
  839. #  endif
  840. #endif
  841. #ifndef PNG_NO_WRITE_cHRM
  842. #  define PNG_WRITE_cHRM_SUPPORTED
  843. #  ifndef PNG_cHRM_SUPPORTED
  844. #    define PNG_cHRM_SUPPORTED
  845. #  endif
  846. #endif
  847. #ifndef PNG_NO_WRITE_gAMA
  848. #  define PNG_WRITE_gAMA_SUPPORTED
  849. #  ifndef PNG_gAMA_SUPPORTED
  850. #    define PNG_gAMA_SUPPORTED
  851. #  endif
  852. #endif
  853. #ifndef PNG_NO_WRITE_hIST
  854. #  define PNG_WRITE_hIST_SUPPORTED
  855. #  ifndef PNG_hIST_SUPPORTED
  856. #    define PNG_hIST_SUPPORTED
  857. #  endif
  858. #endif
  859. #ifndef PNG_NO_WRITE_iCCP
  860. #  define PNG_WRITE_iCCP_SUPPORTED
  861. #  ifndef PNG_iCCP_SUPPORTED
  862. #    define PNG_iCCP_SUPPORTED
  863. #  endif
  864. #endif
  865. #ifndef PNG_NO_WRITE_iTXt
  866. #  ifndef PNG_WRITE_iTXt_SUPPORTED
  867. #    define PNG_WRITE_iTXt_SUPPORTED
  868. #  endif
  869. #  ifndef PNG_iTXt_SUPPORTED
  870. #    define PNG_iTXt_SUPPORTED
  871. #  endif
  872. #endif
  873. #ifndef PNG_NO_WRITE_oFFs
  874. #  define PNG_WRITE_oFFs_SUPPORTED
  875. #  ifndef PNG_oFFs_SUPPORTED
  876. #    define PNG_oFFs_SUPPORTED
  877. #  endif
  878. #endif
  879. #ifndef PNG_NO_WRITE_pCAL
  880. #  define PNG_WRITE_pCAL_SUPPORTED
  881. #  ifndef PNG_pCAL_SUPPORTED
  882. #    define PNG_pCAL_SUPPORTED
  883. #  endif
  884. #endif
  885. #ifndef PNG_NO_WRITE_sCAL
  886. #  define PNG_WRITE_sCAL_SUPPORTED
  887. #  ifndef PNG_sCAL_SUPPORTED
  888. #    define PNG_sCAL_SUPPORTED
  889. #  endif
  890. #endif
  891. #ifndef PNG_NO_WRITE_pHYs
  892. #  define PNG_WRITE_pHYs_SUPPORTED
  893. #  ifndef PNG_pHYs_SUPPORTED
  894. #    define PNG_pHYs_SUPPORTED
  895. #  endif
  896. #endif
  897. #ifndef PNG_NO_WRITE_sBIT
  898. #  define PNG_WRITE_sBIT_SUPPORTED
  899. #  ifndef PNG_sBIT_SUPPORTED
  900. #    define PNG_sBIT_SUPPORTED
  901. #  endif
  902. #endif
  903. #ifndef PNG_NO_WRITE_sPLT
  904. #  define PNG_WRITE_sPLT_SUPPORTED
  905. #  ifndef PNG_sPLT_SUPPORTED
  906. #    define PNG_sPLT_SUPPORTED
  907. #  endif
  908. #endif
  909. #ifndef PNG_NO_WRITE_sRGB
  910. #  define PNG_WRITE_sRGB_SUPPORTED
  911. #  ifndef PNG_sRGB_SUPPORTED
  912. #    define PNG_sRGB_SUPPORTED
  913. #  endif
  914. #endif
  915. #ifndef PNG_NO_WRITE_tEXt
  916. #  define PNG_WRITE_tEXt_SUPPORTED
  917. #  ifndef PNG_tEXt_SUPPORTED
  918. #    define PNG_tEXt_SUPPORTED
  919. #  endif
  920. #endif
  921. #ifndef PNG_NO_WRITE_tIME
  922. #  define PNG_WRITE_tIME_SUPPORTED
  923. #  ifndef PNG_tIME_SUPPORTED
  924. #    define PNG_tIME_SUPPORTED
  925. #  endif
  926. #endif
  927. #ifndef PNG_NO_WRITE_tRNS
  928. #  define PNG_WRITE_tRNS_SUPPORTED
  929. #  ifndef PNG_tRNS_SUPPORTED
  930. #    define PNG_tRNS_SUPPORTED
  931. #  endif
  932. #endif
  933. #ifndef PNG_NO_WRITE_zTXt
  934. #  define PNG_WRITE_zTXt_SUPPORTED
  935. #  ifndef PNG_zTXt_SUPPORTED
  936. #    define PNG_zTXt_SUPPORTED
  937. #  endif
  938. #endif
  939. #ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
  940. #  define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
  941. #  ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
  942. #    define PNG_UNKNOWN_CHUNKS_SUPPORTED
  943. #  endif
  944. #  ifndef PNG_NO_HANDLE_AS_UNKNOWN
  945. #     ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  946. #       define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
  947. #     endif
  948. #  endif
  949. #endif
  950. #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
  951.     defined(PNG_WRITE_zTXt_SUPPORTED)
  952. #  define PNG_WRITE_TEXT_SUPPORTED
  953. #  ifndef PNG_TEXT_SUPPORTED
  954. #    define PNG_TEXT_SUPPORTED
  955. #  endif
  956. #endif
  957.  
  958. #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
  959.  
  960. /* Turn this off to disable png_read_png() and
  961.  * png_write_png() and leave the row_pointers member
  962.  * out of the info structure.
  963.  */
  964. #ifndef PNG_NO_INFO_IMAGE
  965. #  define PNG_INFO_IMAGE_SUPPORTED
  966. #endif
  967.  
  968. /* need the time information for reading tIME chunks */
  969. #if defined(PNG_tIME_SUPPORTED)
  970. #  if !defined(_WIN32_WCE)
  971.      /* "time.h" functions are not supported on WindowsCE */
  972. #    include <time.h>
  973. #  endif
  974. #endif
  975.  
  976. /* Some typedefs to get us started.  These should be safe on most of the
  977.  * common platforms.  The typedefs should be at least as large as the
  978.  * numbers suggest (a png_uint_32 must be at least 32 bits long), but they
  979.  * don't have to be exactly that size.  Some compilers dislike passing
  980.  * unsigned shorts as function parameters, so you may be better off using
  981.  * unsigned int for png_uint_16.  Likewise, for 64-bit systems, you may
  982.  * want to have unsigned int for png_uint_32 instead of unsigned long.
  983.  */
  984.  
  985. typedef unsigned long png_uint_32;
  986. typedef long png_int_32;
  987. typedef unsigned short png_uint_16;
  988. typedef short png_int_16;
  989. typedef unsigned char png_byte;
  990.  
  991. /* This is usually size_t.  It is typedef'ed just in case you need it to
  992.    change (I'm not sure if you will or not, so I thought I'd be safe) */
  993. typedef size_t png_size_t;
  994.  
  995. /* The following is needed for medium model support.  It cannot be in the
  996.  * PNG_INTERNAL section.  Needs modification for other compilers besides
  997.  * MSC.  Model independent support declares all arrays and pointers to be
  998.  * large using the far keyword.  The zlib version used must also support
  999.  * model independent data.  As of version zlib 1.0.4, the necessary changes
  1000.  * have been made in zlib.  The USE_FAR_KEYWORD define triggers other
  1001.  * changes that are needed. (Tim Wegner)
  1002.  */
  1003.  
  1004. /* Separate compiler dependencies (problem here is that zlib.h always
  1005.    defines FAR. (SJT) */
  1006. #ifdef __BORLANDC__
  1007. #  if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
  1008. #    define LDATA 1
  1009. #  else
  1010. #    define LDATA 0
  1011. #  endif
  1012.    /* GRR:  why is Cygwin in here?  Cygwin is not Borland C... */
  1013. #  if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
  1014. #    define PNG_MAX_MALLOC_64K
  1015. #    if (LDATA != 1)
  1016. #      ifndef FAR
  1017. #        define FAR __far
  1018. #      endif
  1019. #      define USE_FAR_KEYWORD
  1020. #    endif   /* LDATA != 1 */
  1021.      /* Possibly useful for moving data out of default segment.
  1022.       * Uncomment it if you want. Could also define FARDATA as
  1023.       * const if your compiler supports it. (SJT)
  1024. #    define FARDATA FAR
  1025.       */
  1026. #  endif  /* __WIN32__, __FLAT__, __CYGWIN__ */
  1027. #endif   /* __BORLANDC__ */
  1028.  
  1029.  
  1030. /* Suggest testing for specific compiler first before testing for
  1031.  * FAR.  The Watcom compiler defines both __MEDIUM__ and M_I86MM,
  1032.  * making reliance oncertain keywords suspect. (SJT)
  1033.  */
  1034.  
  1035. /* MSC Medium model */
  1036. #if defined(FAR)
  1037. #  if defined(M_I86MM)
  1038. #    define USE_FAR_KEYWORD
  1039. #    define FARDATA FAR
  1040. #    include <dos.h>
  1041. #  endif
  1042. #endif
  1043.  
  1044. /* SJT: default case */
  1045. #ifndef FAR
  1046. #  define FAR
  1047. #endif
  1048.  
  1049. /* At this point FAR is always defined */
  1050. #ifndef FARDATA
  1051. #  define FARDATA
  1052. #endif
  1053.  
  1054. /* Typedef for floating-point numbers that are converted
  1055.    to fixed-point with a multiple of 100,000, e.g., int_gamma */
  1056. typedef png_int_32 png_fixed_point;
  1057.  
  1058. /* Add typedefs for pointers */
  1059. typedef void            FAR * png_voidp;
  1060. typedef png_byte        FAR * png_bytep;
  1061. typedef png_uint_32     FAR * png_uint_32p;
  1062. typedef png_int_32      FAR * png_int_32p;
  1063. typedef png_uint_16     FAR * png_uint_16p;
  1064. typedef png_int_16      FAR * png_int_16p;
  1065. typedef PNG_CONST char  FAR * png_const_charp;
  1066. typedef char            FAR * png_charp;
  1067. typedef png_fixed_point FAR * png_fixed_point_p;
  1068.  
  1069. #ifndef PNG_NO_STDIO
  1070. #if defined(_WIN32_WCE)
  1071. typedef HANDLE                png_FILE_p;
  1072. #else
  1073. typedef FILE                * png_FILE_p;
  1074. #endif
  1075. #endif
  1076.  
  1077. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1078. typedef double          FAR * png_doublep;
  1079. #endif
  1080.  
  1081. /* Pointers to pointers; i.e. arrays */
  1082. typedef png_byte        FAR * FAR * png_bytepp;
  1083. typedef png_uint_32     FAR * FAR * png_uint_32pp;
  1084. typedef png_int_32      FAR * FAR * png_int_32pp;
  1085. typedef png_uint_16     FAR * FAR * png_uint_16pp;
  1086. typedef png_int_16      FAR * FAR * png_int_16pp;
  1087. typedef PNG_CONST char  FAR * FAR * png_const_charpp;
  1088. typedef char            FAR * FAR * png_charpp;
  1089. typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
  1090. #ifdef PNG_FLOATING_POINT_SUPPORTED
  1091. typedef double          FAR * FAR * png_doublepp;
  1092. #endif
  1093.  
  1094. /* Pointers to pointers to pointers; i.e., pointer to array */
  1095. typedef char            FAR * FAR * FAR * png_charppp;
  1096.  
  1097. /* libpng typedefs for types in zlib. If zlib changes
  1098.  * or another compression library is used, then change these.
  1099.  * Eliminates need to change all the source files.
  1100.  */
  1101. typedef charf *         png_zcharp;
  1102. typedef charf * FAR *   png_zcharpp;
  1103. typedef z_stream FAR *  png_zstreamp;
  1104.  
  1105. /*
  1106.  * Define PNG_BUILD_DLL if the module being built is a Windows
  1107.  * LIBPNG DLL.
  1108.  *
  1109.  * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL.
  1110.  * It is equivalent to Microsoft predefined macro _DLL that is
  1111.  * automatically defined when you compile using the share
  1112.  * version of the CRT (C Run-Time library)
  1113.  *
  1114.  * The cygwin mods make this behavior a little different:
  1115.  * Define PNG_BUILD_DLL if you are building a dll for use with cygwin
  1116.  * Define PNG_STATIC if you are building a static library for use with cygwin,
  1117.  *   -or- if you are building an application that you want to link to the
  1118.  *   static library.
  1119.  * PNG_USE_DLL is defined by default (no user action needed) unless one of
  1120.  *   the other flags is defined.
  1121.  */
  1122.  
  1123. #if !defined(PNG_DLL) && (defined(PNG_BUILD_DLL) || defined(PNG_USE_DLL))
  1124. #  define PNG_DLL
  1125. #endif
  1126. /* If CYGWIN, then disallow GLOBAL ARRAYS unless building a static lib.
  1127.  * When building a static lib, default to no GLOBAL ARRAYS, but allow
  1128.  * command-line override
  1129.  */
  1130. #if defined(__CYGWIN__)
  1131. #  if !defined(PNG_STATIC)
  1132. #    if defined(PNG_USE_GLOBAL_ARRAYS)
  1133. #      undef PNG_USE_GLOBAL_ARRAYS
  1134. #    endif
  1135. #    if !defined(PNG_USE_LOCAL_ARRAYS)
  1136. #      define PNG_USE_LOCAL_ARRAYS
  1137. #    endif
  1138. #  else
  1139. #    if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
  1140. #      if defined(PNG_USE_GLOBAL_ARRAYS)
  1141. #        undef PNG_USE_GLOBAL_ARRAYS
  1142. #      endif
  1143. #    endif
  1144. #  endif
  1145. #  if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
  1146. #    define PNG_USE_LOCAL_ARRAYS
  1147. #  endif
  1148. #endif
  1149.  
  1150. /* Do not use global arrays (helps with building DLL's)
  1151.  * They are no longer used in libpng itself, since version 1.0.5c,
  1152.  * but might be required for some pre-1.0.5c applications.
  1153.  */
  1154. #if !defined(PNG_USE_LOCAL_ARRAYS) && !defined(PNG_USE_GLOBAL_ARRAYS)
  1155. #  if defined(PNG_NO_GLOBAL_ARRAYS) || (defined(__GNUC__) && defined(PNG_DLL))
  1156. #    define PNG_USE_LOCAL_ARRAYS
  1157. #  else
  1158. #    define PNG_USE_GLOBAL_ARRAYS
  1159. #  endif
  1160. #endif
  1161.  
  1162. #if defined(__CYGWIN__)
  1163. #  undef PNGAPI
  1164. #  define PNGAPI __cdecl
  1165. #  undef PNG_IMPEXP
  1166. #  define PNG_IMPEXP
  1167. #endif  
  1168.  
  1169. /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
  1170.  * you may get warnings regarding the linkage of png_zalloc and png_zfree.
  1171.  * Don't ignore those warnings; you must also reset the default calling
  1172.  * convention in your compiler to match your PNGAPI, and you must build
  1173.  * zlib and your applications the same way you build libpng.
  1174.  */
  1175.  
  1176. #ifndef PNGAPI
  1177.  
  1178. #if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
  1179. #  ifndef PNG_NO_MODULEDEF
  1180. #    define PNG_NO_MODULEDEF
  1181. #  endif
  1182. #endif
  1183.  
  1184. #if !defined(PNG_IMPEXP) && defined(PNG_BUILD_DLL) && !defined(PNG_NO_MODULEDEF)
  1185. #  define PNG_IMPEXP
  1186. #endif
  1187.  
  1188. #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
  1189.     (( defined(_Windows) || defined(_WINDOWS) || \
  1190.        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
  1191.  
  1192. #  if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
  1193. #    define PNGAPI __cdecl
  1194. #  else
  1195. #    define PNGAPI _cdecl
  1196. #  endif
  1197.  
  1198. #  if !defined(PNG_IMPEXP) && (!defined(PNG_DLL) || \
  1199.        0 /* WINCOMPILER_WITH_NO_SUPPORT_FOR_DECLIMPEXP */)
  1200. #     define PNG_IMPEXP
  1201. #  endif
  1202.  
  1203. #  if !defined(PNG_IMPEXP)
  1204.  
  1205. #     define PNG_EXPORT_TYPE1(type,symbol)  PNG_IMPEXP type PNGAPI symbol
  1206. #     define PNG_EXPORT_TYPE2(type,symbol)  type PNG_IMPEXP PNGAPI symbol
  1207.  
  1208.       /* Borland/Microsoft */
  1209. #     if defined(_MSC_VER) || defined(__BORLANDC__)
  1210. #        if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500)
  1211. #           define PNG_EXPORT PNG_EXPORT_TYPE1
  1212. #        else
  1213. #           define PNG_EXPORT PNG_EXPORT_TYPE2
  1214. #           if defined(PNG_BUILD_DLL)
  1215. #              define PNG_IMPEXP __export
  1216. #           else
  1217. #              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
  1218.                                                  VC++ */
  1219. #           endif                             /* Exists in Borland C++ for
  1220.                                                  C++ classes (== huge) */
  1221. #        endif
  1222. #     endif
  1223.  
  1224. #     if !defined(PNG_IMPEXP)
  1225. #        if defined(PNG_BUILD_DLL)
  1226. #           define PNG_IMPEXP __declspec(dllexport)
  1227. #        else
  1228. #           define PNG_IMPEXP __declspec(dllimport)
  1229. #        endif
  1230. #     endif
  1231. #  endif  /* PNG_IMPEXP */
  1232. #else /* !(DLL || non-cygwin WINDOWS) */
  1233. #    if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
  1234. #      define PNGAPI _System
  1235. #      define PNG_IMPEXP
  1236. #    else
  1237. #      if 0 /* ... other platforms, with other meanings */
  1238. #      else
  1239. #        define PNGAPI
  1240. #        define PNG_IMPEXP
  1241. #      endif
  1242. #    endif
  1243. #endif
  1244. #endif
  1245.  
  1246. #ifndef PNGAPI
  1247. #  define PNGAPI
  1248. #endif
  1249. #ifndef PNG_IMPEXP
  1250. #  define PNG_IMPEXP
  1251. #endif
  1252.  
  1253. #ifndef PNG_EXPORT
  1254. #  define PNG_EXPORT(type,symbol) PNG_IMPEXP type PNGAPI symbol
  1255. #endif
  1256.  
  1257. #ifdef PNG_USE_GLOBAL_ARRAYS
  1258. #  ifndef PNG_EXPORT_VAR
  1259. #    define PNG_EXPORT_VAR(type) extern PNG_IMPEXP type
  1260. #  endif
  1261. #endif
  1262.  
  1263. /* User may want to use these so they are not in PNG_INTERNAL. Any library
  1264.  * functions that are passed far data must be model independent.
  1265.  */
  1266.  
  1267. #ifndef PNG_ABORT
  1268. #  define PNG_ABORT() abort()
  1269. #endif
  1270.  
  1271. #ifdef PNG_SETJMP_SUPPORTED
  1272. #  define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
  1273. #else
  1274. #  define png_jmpbuf(png_ptr) \
  1275.    (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
  1276. #endif
  1277.  
  1278. #if defined(USE_FAR_KEYWORD)  /* memory model independent fns */
  1279. /* use this to make far-to-near assignments */
  1280. #  define CHECK   1
  1281. #  define NOCHECK 0
  1282. #  define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
  1283. #  define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
  1284. #  define png_strcpy _fstrcpy
  1285. #  define png_strlen _fstrlen
  1286. #  define png_memcmp _fmemcmp      /* SJT: added */
  1287. #  define png_memcpy _fmemcpy
  1288. #  define png_memset _fmemset
  1289. #else /* use the usual functions */
  1290. #  define CVT_PTR(ptr)         (ptr)
  1291. #  define CVT_PTR_NOCHECK(ptr) (ptr)
  1292. #  define png_strcpy strcpy
  1293. #  define png_strlen strlen
  1294. #  define png_memcmp memcmp     /* SJT: added */
  1295. #  define png_memcpy memcpy
  1296. #  define png_memset memset
  1297. #endif
  1298. /* End of memory model independent support */
  1299.  
  1300. /* Just a little check that someone hasn't tried to define something
  1301.  * contradictory.
  1302.  */
  1303. #if (PNG_ZBUF_SIZE > 65536) && defined(PNG_MAX_MALLOC_64K)
  1304. #  undef PNG_ZBUF_SIZE
  1305. #  define PNG_ZBUF_SIZE 65536
  1306. #endif
  1307.  
  1308. #ifdef PNG_READ_SUPPORTED
  1309. /* Prior to libpng-1.0.9, this block was in pngasmrd.h */
  1310. #if defined(PNG_INTERNAL)
  1311.  
  1312. /* These are the default thresholds before the MMX code kicks in; if either
  1313.  * rowbytes or bitdepth is below the threshold, plain C code is used.  These
  1314.  * can be overridden at runtime via the png_set_mmx_thresholds() call in
  1315.  * libpng 1.2.0 and later.  The values below were chosen by Intel.
  1316.  */
  1317.  
  1318. #ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
  1319. #  define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT  128  /*  >=  */
  1320. #endif
  1321. #ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
  1322. #  define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT  9    /*  >=  */   
  1323. #endif
  1324.  
  1325. /* Set this in the makefile for VC++ on Pentium, not here. */
  1326. /* Platform must be Pentium.  Makefile must assemble and load pngvcrd.c .
  1327.  * MMX will be detected at run time and used if present.
  1328.  */
  1329. #ifdef PNG_USE_PNGVCRD
  1330. #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
  1331. #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
  1332. #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
  1333. #endif
  1334.  
  1335. /* Set this in the makefile for gcc/as on Pentium, not here. */
  1336. /* Platform must be Pentium.  Makefile must assemble and load pnggccrd.c .
  1337.  * MMX will be detected at run time and used if present.
  1338.  */
  1339. #ifdef PNG_USE_PNGGCCRD
  1340. #  define PNG_HAVE_ASSEMBLER_COMBINE_ROW
  1341. #  define PNG_HAVE_ASSEMBLER_READ_INTERLACE
  1342. #  define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
  1343. #endif
  1344. /* - see pnggccrd.c for info about what is currently enabled */
  1345.  
  1346. #endif /* PNG_INTERNAL */
  1347. #endif /* PNG_READ_SUPPORTED */
  1348.  
  1349. #endif /* PNGCONF_H */
  1350.  
  1351.